package com.edu.his.controller;

import ch.qos.logback.core.net.SyslogOutputStream;
import com.edu.his.domain.Employee;
import com.edu.his.domain.Register;
import com.edu.his.service.*;
import com.edu.his.util.R;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Calendar;

/**
 * 描述：
 * 创建人：飘
 * 创建时间：2024/12/17
 **/
@RestController
@RequestMapping("/register")
@CrossOrigin(value = "*",maxAge = 3600)
public class RegiterController {
    @Autowired
    private EmployeeService service;
    @Autowired
    private DepartmentService departmentService;
    @Autowired
    private RegistLevelService registLevelService;
    @Autowired
    private RegisterService registerService;

    @Autowired
    private  EmployeeService employeeService;
    @Autowired
    private SettleCategoryService settleCategoryService;


    @GetMapping("/getsettlecategory")
    public R getSettleCategory()
    {
        return  this.settleCategoryService.getSettleCategory();
    }


    @GetMapping("/getregistlevel")
    public R getRegistLevel()
    {
        return  this.registLevelService.getRegistLevel();
    }

    @PostMapping("/insert")
    public R insert(@RequestBody Register register)
    {
        return  this.registerService.insert(register);
    }

    @GetMapping("/getdepartment/{deptType}")
    public R getDepartment(@PathVariable("deptType") String deptType)
    {
        return  this.departmentService.getDepartment(deptType);
    }

    @GetMapping("/getcasenumber")
    public R getCaseNumber()
    {
        return  this.registerService.getCaseNumber();
    }

    @PostMapping("/getemployee")
    public R getEmployee(@RequestBody Employee employee)
    {
        return  this.employeeService.getEmployee(employee);
    }


    @PostMapping("/getuseregistercount")
    public R getUseRegisterCount(@RequestBody Register register)
    {
        return  this.registerService.getUseRegisterCount(register);
    }

    @PostMapping("/selectstatepage/{currPage}")
    public R selectStatePage(@PathVariable("currPage") Integer currPage,@RequestBody Register register)
    {
        return  this.registerService.selectStatePage(currPage,register);
    }

    @GetMapping("/selectbydepartmentid/{departmentId}")
    public R selectByDepartmentId(@PathVariable("departmentId") Integer departmentId)
    {
        return  this.employeeService.selectByDepartmentId(departmentId);
    }

    /**
     * 修改挂号状态
     *
     * @param register
     * @return
     */
    @PutMapping("/updatestate")
    public R updateState(@RequestBody  Register register)
    {
        return  this.registerService.updateState(register);
    }


    @PostMapping("/selectpatient")
    public R selectPatient(@RequestBody  Register register) {
        return  this.registerService.selectPatient(register);
    }


    @PostMapping("/selectpatients/{currPage}")
    public R selectPatients(@PathVariable("currPage") Integer currPage, @RequestBody Register register) {
        return  this.registerService.selectPatients(currPage,register);

    }
    @GetMapping("/test")
    public String test()
    {

//        Date
            Calendar calendar=Calendar.getInstance();

//            //周日(1)--周六(7)
//            int w=calendar.get(Calendar.DAY_OF_WEEK);
//            System.out.println("000000000000000000");
//            System.out.println("="+w);
//            System.out.println("000000000000000000");

         System.out.println("值:"+calendar.get(Calendar.AM_PM));
            return "test";
    }
}
